package me.zixing.java.chapter07.task02;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class CollegianManager {
	public static void main(String[] args) {
		List<Collegian> collegians = new ArrayList<>();
		
		for (int i = 0; i < 10; i++) {
			Collegian collegian = new Collegian();
			collegian.studentNo = i+"";
			collegian.name = i+"";
			collegian.major = "major"+i;
			collegians.add(collegian);
		}
		
		
		Iterator<Collegian> iterator = collegians.iterator();
		
		while(iterator.hasNext()){
			Collegian next = iterator.next();
			if(next.major.equals("major2")){
				iterator.remove();
			}
		}
		
		for (Collegian collegian : collegians) {
			System.out.println("studentNo:" +collegian.studentNo);
			System.out.println("name:" +collegian.name);
			System.out.println("major:" +collegian.major);
		}
		
		
	}
}
